fix(rt): resolve thunk(operandCopy) in projection traversal#956
Draft
fix(rt): resolve thunk(operandCopy) in projection traversal#956
Conversation
…w creation
When a value is thunked as thunk(operandCopy(place(...))), projection
traversal and borrow creation had no rules to resolve the thunk, causing
stuck #traverseProjection ~> #readProjection / #forRef terms.
Add #isThunkOperandCopy predicate and four #traverseProjection rules
that compose remaining projections onto the thunked place and delegate
to existing operand evaluation:
- Copy-read: resolve to operandCopy with composed place
- Move-read: emit #writeMoved then resolve the copy
- Write: delegate to #setLocalValue on composed place
- Borrow (#forRef): materialize #mkRef directly to avoid re-traversal
Guard existing .ProjectionElems terminal rules with
notBool #isThunkOperandCopy(VAL) to prevent premature matching.
Tests: iter-copied-take-next-thunk-fail.rs,
iter-map-eq-copied-take-thunk-fail.rs
Add a rule for `aggregateKindClosure` to construct closures as `Aggregate(variantIdx(0), ARGS)`, matching the existing tuple and ADT aggregate handling. Add an `[owise]` fallback to `#setTupleArgs` for `Value` arguments that are not wrapped in an `Aggregate` tuple. This handles closure-call paths where a single argument is passed directly. Test: `closure-no-capture.rs` — a non-capturing closure passed through a generic `FnOnce` call. Exercises the `#setTupleArgs` fallback for unwrapped single-value arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
thunk(operandCopy(place(...))).#isThunkOperandCopyguard so terminal projection rules do not match too early on unresolved thunked copy-place values.Context
Projection traversal could get stuck when a projected value is
thunk(operandCopy(place(...))), especially in iterator/closure borrow paths.Red vs Green
RED (stuck frontier):
No complete continuation for this thunked projection/borrow shape.
GREEN (new explicit continuation):
and terminal
.ProjectionElemsread rules are guarded bynotBool #isThunkOperandCopy(VAL).